$OpenBSD: patch-makefile,v 1.10 2017/02/27 21:54:20 naddy Exp $
--- makefile.orig	Mon Feb 27 22:21:09 2017
+++ makefile	Mon Feb 27 22:21:38 2017
@@ -227,10 +227,10 @@ endif
 # BIGENDIAN = 1
 
 # uncomment next line to build expat as part of MAME build
-BUILD_EXPAT = 1
+# BUILD_EXPAT = 1
 
 # uncomment next line to build zlib as part of MAME build
-BUILD_ZLIB = 1
+# BUILD_ZLIB = 1
 
 # uncomment next line to build libflac as part of MAME build
 BUILD_FLAC = 1
@@ -364,8 +364,8 @@ endif
 # compiler, linker and utilities
 ifneq ($(TARGETOS),emscripten)
 AR = @ar
-CC = @gcc
-LD = @g++
+CC ?= @gcc
+LD ?= @g++
 endif
 MD = -mkdir$(BUILD_EXE)
 RM = @rm -f
@@ -417,7 +417,7 @@ NAME = $(TARGET)$(SUBTARGET)
 endif
 
 # fullname is prefix+name+suffix+suffix64+suffixdebug
-FULLNAME ?= $(BIN)$(PREFIX)$(PREFIXSDL)$(NAME)$(SUFFIX)$(SUFFIX64)$(SUFFIXDEBUG)$(SUFFIXPROFILE)
+FULLNAME = $(PREFIXSDL)$(NAME)$(SUFFIX)$(SUFFIXDEBUG)$(SUFFIXPROFILE)
 
 # add an EXE suffix to get the final emulator name
 EMULATOR = $(FULLNAME)$(EXE)
@@ -520,7 +520,7 @@ CPPONLYFLAGS =
 
 # CFLAGS is defined based on C or C++ targets
 # (remember, expansion only happens when used, so doing it here is ok)
-CFLAGS = $(CCOMFLAGS) $(CPPONLYFLAGS) $(INCPATH)
+CFLAGS += $(CCOMFLAGS) $(CPPONLYFLAGS) $(INCPATH)
 
 # we compile C-only to C89 standard with GNU extensions
 # we compile C++ code to C++98 standard with GNU extensions
@@ -562,7 +562,7 @@ CCOMFLAGS += -pg
 endif
 
 # add the optimization flag
-CCOMFLAGS += -O$(OPTIMIZE)
+# CCOMFLAGS += -O$(OPTIMIZE)
 
 # add the error warning flag
 ifndef NOWERROR
